<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
                xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <fo:layout-master-set>
            <fo:simple-page-master
                master-name="PAGEMASTER"
                page-width="210mm"
                page-height="215mm"
                margin="0.3cm">
                <fo:region-body
                    background-image="mitte.png" background-repeat="no-repeat"
                    region-name="mitte"/>
                <fo:region-before
                    region-name="davor"
                    extent="6cm"/>
            </fo:simple-page-master>
        </fo:layout-master-set> 
        
            <xsl:apply-templates/>    
           
    </fo:root> 
    
</xsl:template>
    
<xsl:template match="//produkt">   
    <fo:page-sequence master-reference="PAGEMASTER">
        <fo:flow flow-name="mitte">
            <fo:block
                background-image="regionBeforeBackground.png"
                background-repeat="no-repeat">
                <fo:block
                    font-family="Verdana"
                    font-size="70pt"
                    font-style="italic"
                    text-align="center"
                    padding-top="1.5cm"
                    padding-left="6.5cm"> 
                    Powerfish
                </fo:block>
            </fo:block>
            <fo:block space-before="0.5cm"  height="260mm">
                <fo:block width="20.4cm" height="0.8cm" margin-left="9cm" font-size="10pt">
                    <xsl:value-of select="./@typ"/> >>
                    <xsl:value-of select="./hersteller[.]"/> >>
                    <xsl:value-of select="./produktname[.]"/>
                </fo:block>
                <fo:table space-before="1cm" margin-left="0.5cm">
                    <fo:table-column column-width="8cm"/>
                    <fo:table-column  />
                    <fo:table-body>
                        <fo:table-row >
                            <fo:table-cell>
                                <fo:block>
                                    <fo:external-graphic src="{./produktbild[.]}" content-height="5cm" content-width="5cm" padding-left="1cm"/>
                                </fo:block>
                            </fo:table-cell>
                            
                            <!-- gibt die Zeilen neben dem Bild aus-->
                            <fo:table-cell>
                                <fo:block>
                                    <fo:block space-before="2cm" font-family="Times Roman" font-weight="900" font-size="25pt">
                                        <xsl:value-of select="./produktname[.]"/>
                                    </fo:block>
                                    <fo:block space-before="0.5cm"  font-size="15pt"     >
                                        Hersteller:
                                        <fo:inline font-family="Times Roman">                                            
                                            <xsl:value-of select="./hersteller[.]"/>
                                        </fo:inline>
                                    </fo:block>
                                    <fo:block space-before="0cm"  font-size="15pt">
                                        Preis:
                                        <fo:inline font-family="Times Roman"> 
                                            <xsl:value-of select="./preis[.]"/> €
                                        </fo:inline>
                                    </fo:block>
                                    <fo:block space-before="0cm"  font-size="15pt" >
                                        Menge:
                                        <fo:inline font-family="Times Roman"> 
                                            <xsl:value-of select="./preis/@*"/>                                           
                                            <xsl:choose>
                                                <xsl:when test="./preis/@*/name() = 'stueckProPackung'"> Stück</xsl:when>
                                                <xsl:when test="./preis/@*/name() = 'volumenInLiter'"> Liter</xsl:when>
                                                <xsl:when test="./preis/@*/name() = 'gewichtInKilo'"> Kilo</xsl:when>
                                            </xsl:choose>
                                        </fo:inline>
                                    </fo:block>
                                    <fo:block space-before="0.5cm"  font-size="15pt">
                                        Fischfutter geeignet für:
                                        <fo:block font-family="Times Roman"> 
                                            <xsl:for-each select="./geeignetfuer/*">
                                                <fo:block> - <xsl:value-of select="."/></fo:block>
                                            </xsl:for-each>                                            
                                        </fo:block>
                                    </fo:block>
                                </fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
                
                <fo:block space-before="0.5cm" font-size="15pt" margin-left="1cm">
                    Beschreibung:
                    <fo:inline font-family="Times Roman" font-size="15pt">
                        <xsl:value-of select="./beschreibung"/>
                    </fo:inline>    
                </fo:block>
                <fo:block  space-before="0cm"  font-size="15pt" margin-left="1cm">
                    <fo:block> 
                        <xsl:value-of select="Beschreibung"/>
                    </fo:block>
                </fo:block>
                <fo:block space-before="1cm"  font-size="15pt" font-style="italic" margin-left="1cm" >
                    Falls Sie noch Fragen zu unseren Produkten oder uns selbst haben, melden Sie sich einfach unter den unten angegebenen Kontaktdaten.
                    Wir beraten Sie gern!
                </fo:block>    
                
                <!-- gibt Telefon und Mailaddy aus-->
                
                <fo:table space-before="0.25cm" margin-left="0.5cm" margin-right="0.5cm" table-layout="fixed">
                    <fo:table-column />
                    <fo:table-column />
                    <fo:table-column />
                    <fo:table-body>
                        <fo:table-row >
                            <fo:table-cell>
                                <fo:block font-style="italic">
                                    Telefon: 0190 / 12 34 51 
                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell>
                                <fo:block font-style="italic">
                                    E-Mail: Powerfish@gmx.de        
                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell>
                                <fo:block font-style="italic" text-align="right">
                                    <xsl:value-of select="substring(string(current-date()),0,11)"/>
                                </fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
                    <fo:block space-before="0.3cm" text-align="center" text-decoration="underline">
                        www.Powerfish.de  
                    </fo:block>
                                
            </fo:block>
            
        </fo:flow>
                
    </fo:page-sequence>
</xsl:template>    
</xsl:stylesheet>
